package com.polaris.live.im.sfs.processor

import com.polaris.live.im.sfs.core.ClientType
import com.polaris.live.im.sfs.core.MessageMediator
import com.polaris.live.im.sfs.core.bean.DataArgument

/**
 * AbstractMessageProcessor
 *
 * 需要在[MessageMediator]里面注册
 *
 * @author Created by lucas on 2023/10/19 10:23
 */
abstract class AbstractMessageProcessor : MessageProcessor {

    override fun order(): Int = 0

    /**
     * 默认是继续处理，如果需要中断处理，可以重写此方法
     */
    override suspend fun process(@ClientType type: Int, command: String, argument: DataArgument): MessageProcessSignal {
        handle(type, command, argument)

        return ProceedMessageProcessSignal
    }

    abstract suspend fun handle(@ClientType type: Int, command: String, argument: DataArgument)

}